package com.xckj.cycling.view;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

import com.xckj.cycling.utils.StatusBarHelper;


/**
 * 只是状态栏占位没有实际效果，可以渲染颜色
 *
 * @author liyang
 */
public class StatusBarPlaceHolderView extends View {
    public StatusBarPlaceHolderView(Context context) {
        super(context);
    }

    public StatusBarPlaceHolderView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public StatusBarPlaceHolderView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public StatusBarPlaceHolderView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), StatusBarHelper.getStatusbarHeight(getContext()));
    }
}
